home *** CD-ROM | disk | FTP | other *** search
- -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C)
- -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
- --
- class TEST_CHARACTER
- --
- -- Test CHARACTER / CHARACTER_REF
- --
- creation {ANY}
- make
-
- feature {ANY}
-
- make is
- local
- cr: CHARACTER_REF;
- a: ANY;
- aa: ARRAY[ANY];
- do
- is_true('a' = 'a');
- is_true('a' < 'b');
- is_true('a' <= 'b');
- is_true('b' <= 'b');
- is_true(('a').to_upper = 'A');
- is_true(('z').to_upper = 'Z');
- is_true(('+').to_upper = '+');
-
- is_true(('A').to_lower = 'a');
- is_true(('Z').to_lower = 'z');
- is_true(('+').to_lower = '+');
-
- is_true(('0').is_digit);
- is_true(('1').is_digit);
- is_true(('2').is_digit);
- is_true(('3').is_digit);
- is_true(('4').is_digit);
- is_true(('5').is_digit);
- is_true(('6').is_digit);
- is_true(('7').is_digit);
- is_true(('8').is_digit);
- is_true(('9').is_digit);
- is_true(not ('x').is_digit);
-
- is_true(('0').value = 0);
- is_true(('1').value = 1);
- is_true(('2').value = 2);
- is_true(('3').value = 3);
- is_true(('4').value = 4);
- is_true(('5').value = 5);
- is_true(('6').value = 6);
- is_true(('7').value = 7);
- is_true(('8').value = 8);
- is_true(('9').value = 9);
-
- is_true(('a').code = 97);
- is_true(('z').code = 122);
- is_true(('A').code = 65);
- is_true(('Z').code = 90);
-
- cr := 'x';
- is_true(cr.item = 'x');
- a := 'x';
- is_true(equal(a,cr));
- is_true(equal(cr,'x'));
- is_true(equal(a,'x'));
-
- !!aa.make(1,1);
- aa.put('a',1);
- is_true(equal(aa.item(1),'a'));
- -- **** A FAIRE *** is_true(26 = aa.item(1));
- end;
-
- is_true(b: BOOLEAN) is
- do
- cpt := cpt + 1;
- if not b then
- std_output.put_string("TEST_CHARACTER: ERROR Test # ");
- std_output.put_integer(cpt);
- std_output.put_string("%N");
- else
- --std_output.put_string("Yes%N");
- end;
- end;
-
- cpt: INTEGER;
-
- end -- TEST_CHARACTER
-